#include<iostream>
using namespace std;
int main()
{
	int a, b;cin >> a >> b;
	int time = 0;
	int consume = 0;
	while (a)
	{
		consume++;time++;
		if (consume % b == 0) a++;
		a--;
	}
	cout << time;
	return 0;
}